# Create your views here.

from django.shortcuts import render_to_response
from polgr.main import models 
from django import forms

class SearchForm(forms.Form):
    key = forms.CharField()
    threshold = forms.IntegerField()

def main(request):
    if request.method == 'POST': # If the form has been submitted...
        form = SearchForm(request.POST) # A form bound to the POST data
        if form.is_valid(): # All validation rules pass
            # Process the data in form.cleaned_data
            # ...
            c=models.GetContent(form.cleaned_data['key'],form.cleaned_data['threshold'])
            return render_to_response("base.html",{'c':c})
    else:
        form = SearchForm() # An unbound form

    return render_to_response('search.html', {
        'form': form,
    })    
